import { AssignmentDisplayOutput, CommonServiceProxy, DefaultArrangementInput, GetDashboardDataOutput, HandManageInput, OperationLogDto, OrganizationUnitDto, OrganizationUnitUserListDto, ProcessLineDto, ProcessNodeDto } from './../../../shared/service-proxies/service-proxies';
import { Component, Injector, ViewChild } from '@angular/core';
import { LazyLoadEvent } from 'primeng/components/common/lazyloadevent';
import { MessageService } from '@abp/message/message.service';
import { Table } from 'primeng/components/table/table';
import { Paginator } from 'primeng/components/paginator/paginator';
import { InspectionHandleServiceProxy, InspectionFileCommonServiceServiceProxy, InspectionSeverityDescOutDto, MatingManagerServiceProxy, InspectionStandardDescDto, CodeFormatDescServiceProxy, OperationHistoryServiceProxy, InspectionTypeDescDto, InspectionFileUploadDto, ProductionAssignmentServiceProxy, ProductionDesignServiceProxy, AssignmentTreeOutput } from '@shared/service-proxies/service-proxies';
import { finalize } from 'rxjs/operators';
import { AppComponentBase } from '@shared/common/app-component-base';
import { AppSessionService } from '@shared/common/session/app-session.service';
import { TreeNode } from 'primeng/api';
import * as go from "gojs";
import * as moment from 'moment';
@Component({
    selector: 'app-manufacture-plan',
    templateUrl: './manufacture-plan.component.html',
    styleUrls: ['./manufacture-plan.component.less']
})
export class ManufacturePlanComponent extends AppComponentBase {
    @ViewChild('paginator') paginator: Paginator;
    @ViewChild('dataTable') dataTable: Table;
    modelList: any[];
    lotNoList: any[];
    childNodes: any;
    productionPlan: AssignmentDisplayOutput;
    processLineList: ProcessLineDto[];//芯及路线
    processNodeList: ProcessNodeDto[];
    diagram = undefined; // 路线图
    nodeDataArray = [
        { key: "LM23", category: "Process", loc: "100 0", text: "LM23" },
        { key: "LM20", category: "Process", loc: "0 100", text: "LM20" },
        { key: "LM21", category: "Process", loc: "70 120", text: "LM21" },
        { key: "LM22", category: "Process", loc: "170 100", text: "LM22" },
        { key: "LM24", category: "Process", loc: "60 220", text: "LM24" },
        // { key: "", category: "Valve", loc: "", text: "" },
    ]; // 节点数据
    linkDataArray = [
        { from: "LM23", to: "LM20", category: "hasGj" }, // routing: go.Link.Orthogonal 直线弯曲
        { from: "LM20", to: "LM24" },
        { from: "LM21", to: "LM23" },
        { from: "LM21", to: "LM24" },
        { from: "LM23", to: "LM22" },
        { from: "LM22", to: "LM24" },
    ]; // 线数据
    handelInfo = new HandManageInput();
    logList: OperationLogDto[];
    getOrganizationUnitList: OrganizationUnitDto[];
    getOrganizationUnitUsersByIdList: OrganizationUnitUserListDto[];
    selectNode: any;
    isCilcking: boolean = false;
    impFlag = false;
    startTimeH = undefined;
    endTimeH = undefined;
    //日期显示中文
    chinese = {
        /** 每周第一天，0代表周日 */
        firstDayOfWeek: 0,
        /** 每周天数正常样式 */
        dayNames: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
        /** 每周天数短样式（位置较小时显示） */
        dayNamesShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
        /** 每周天数最小样式 */
        dayNamesMin: ["日", "一", "二", "三", "四", "五", "六"],
        /** 每月月份正常样式 */
        monthNames: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
        /** 每月月份短样式 */
        monthNamesShort: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]
    }
    constructor(
        injector: Injector,
        private _messageService: MessageService,
        private _inspectionHandleServiceProxy: InspectionHandleServiceProxy,
        private _codeFormatDescServiceProxy: CodeFormatDescServiceProxy,
        private _operationHistoryServiceProxy: OperationHistoryServiceProxy,
        private _inspectionFileCommonServiceServiceProxy: InspectionFileCommonServiceServiceProxy,
        private _user: AppSessionService,
        private _productionAssignmentServiceProxy: ProductionAssignmentServiceProxy,
        private _productionDesignServiceProxy: ProductionDesignServiceProxy,
        private _commonServiceProxy: CommonServiceProxy,
        private _matingManagerServiceProxy: MatingManagerServiceProxy,
    ) {
        super(injector);
        this.data2 = [{
            label: 'F.C Barcelona',
            expanded: true,
            children: [
                {
                    label: 'F.C Barcelona',
                    expanded: true,
                    children: [
                        {
                            label: 'Chelsea FC'
                        },
                        {
                            label: 'F.C. Barcelona'
                        }
                    ]
                },
                {
                    label: 'Real Madrid',
                    expanded: true,
                    children: [
                        {
                            label: 'Bayern Munich'
                        },
                        {
                            label: 'Real Madrid'
                        }
                    ]
                }
            ]
        }];
    }
    files2: AssignmentTreeOutput[];
    selectedFiles1: AssignmentTreeOutput;
    tasklist: any = [];//任务编号列表
    queryInfo = {
        model: undefined,
        lotNo: undefined,
    };//查询条件
    typeDescList: any[];//一级异常下拉
    rangeDates: string;//统计时间
    dialogType: string = '新增'
    addVisible: boolean = false;//弹窗 参数
    llVisible: boolean = false;//履历 参数
    defaultVisible: boolean = false;//默认排配计划 参数
    defaultInfo = new DefaultArrangementInput()
    defaultEndTime = undefined;
    // addInfoUi = new HandManageInput();//修改集合
    addInfoUi: any = {
        startTime: "",
    };//修改集合
    formatDropList: any[];//编码规则 列表
    severityDescList: InspectionSeverityDescOutDto[];//等级下拉
    userList: any[];//处理人 提报人下拉
    savingAddDia: boolean = false;//禁止频繁保存操作
    itemInfoList: any[];//二级异常下拉
    data2: TreeNode[];
    selectRow: any = [];
    goGo = go.GraphObject.make;
    shortageVisible: boolean = false
    saveFlag = true;
    material = [];
    banZuFlag = false;
    ngOnInit() {
        this.getmodelList()
        this.getDesigenTree()
        this.diagram = this.goGo(go.Diagram, "myDiagramDiv");
        this.getOrganizationUnit()
    }
    getMaterial(row) {
        this.shortageVisible = true;
        this._matingManagerServiceProxy.getStarvingContent(
            row.id,
            undefined
        )
            .pipe(finalize(() => { }))
            .subscribe(result => {
                this.material = result;
            });
    }
    // 获取班组
    getOrganizationUnit() {
        this._productionAssignmentServiceProxy.getOrganizationUnit(
        )
            .pipe(finalize(() => { }))
            .subscribe(result => {
                this.getOrganizationUnitList = result
            });
    }
    //班组 change事件
    unitChangeEv(ev) {
        let idArr = []
        ev.forEach(element => {
            idArr.push(element.id)
        });
        this.getOrganizationUnitUsersById(idArr)
    }
    // 获取装配人员n
    getOrganizationUnitUsersById(organizationIdList) {
        this._productionAssignmentServiceProxy.getOrganizationUnitUsersById(
            organizationIdList
        )
            .pipe(finalize(() => { }))
            .subscribe(result => {
                let length = result.length;
                for (let i = 0; i < length; i++) {
                    for (let j = i + 1; j < length; j++) {
                        if (result[i].id == result[j].id) {
                            result.splice(j, 1);
                            length--;
                            j--;
                        }
                    }
                }
                this.getOrganizationUnitUsersByIdList = result
            });
    }
    //型号下拉
    getmodelList() {
        this._commonServiceProxy.getModelList(
        )
            .pipe(finalize(() => { }))
            .subscribe(result => {
                this.modelList = result
            });
    }
    /**
     * 发次
       lotstr — (optional)
       model — (optional)
     */
    getLotNoList(val): any {
        this._commonServiceProxy.getLotNoList(
            val.value
        )
            .pipe(finalize(() => { }))
            .subscribe(result => {
                this.lotNoList = result
            });
    }
    // 组合为需要的数据格式
    setSelectProps(val) {
        return {
            label: val,
            value: val
        }
    }
    /**
     根据型号与发次查询树结构
     * //  model — (optional)
      //lotNo — (optional)
     */
    getDesigenTree() {
        this._productionDesignServiceProxy.getProductionDesigenTree(
            this.queryInfo.model ? this.queryInfo.model.value : undefined,
            this.queryInfo.lotNo ? this.queryInfo.lotNo.value : undefined,
        )
            .pipe(finalize(() => { }))
            .subscribe(result => {
                let arr: AssignmentTreeOutput[] = []
                arr.push(result)
                this.files2 = this.isEqual(JSON.parse(JSON.stringify(arr)))
            });
    }
    // 组合树结构数据
    isEqual(obj1) {
        for (const iterator of obj1) {
            iterator.label = iterator.nodeName
            iterator.expandedIcon = ""
            iterator.collapsedIcon = ""
            if (iterator.treeList) {
                iterator.children = iterator.treeList
                this.isEqual(iterator.treeList)
            }
        }
        return obj1
    }
    //点击树节点
    nodeSelect(event): void {
        /// id Id
        /// 节点名称  NodeName
        /// 图号 NodeDrawingNo
        /// 是否关联 IsRelation
        /// 父ID  ParentId
        /// 层级 NodeLevel  8工序   9工步
        /// 父节点Code  ParentCode
        /// 节点Code NodeCode
        /// 是否叶节点 IsLeaf
        /// 是否导出 IsExport
        this.selectNode = event.node
        this.selectRow = [];
        this.getNodePlanDetails()
        if (event.node.isRelation === 1) {//树结构判断是否有子节点
            event.node.children = []
            event.node.treeList = []
            this.getProductionTechquine(event.node.id, event.node)
        }
    }
    /**点击树节点展示节点信息
     * nodeId
     * bopDescId
     * sorting
     * maxResultCount
     * skipCount
     */
    getNodePlanDetails(event?: LazyLoadEvent): void {
        abp.ui.setBusy();
        this.nodeDataArray = []
        this.linkDataArray = []
        this.diagram.model = new go.GraphLinksModel(
            this.nodeDataArray,
            this.linkDataArray
        );
        this._productionDesignServiceProxy.getNodePlanDetails(
            this.selectNode.id,
            this.files2[0].id,
            this.primengTableHelper.getSorting(this.dataTable),//undefined
            this.primengTableHelper.getMaxResultCount(this.paginator, event),//10
            this.primengTableHelper.getSkipCount(this.paginator, event)//0
        )
            .pipe(finalize(() => { }))
            .subscribe(result => {
                abp.ui.clearBusy();
                if (result.count == 0) {
                    this.primengTableHelper.totalRecordsCount = result.count;
                    this.primengTableHelper.records = result.productions;
                    this.productionPlan = result
                    this.primengTableHelper.hideLoadingIndicator();
                    this.processLineList = result.processLineList
                    this.diagram.model = new go.GraphLinksModel(
                        this.nodeDataArray,
                        this.linkDataArray
                    );
                    return
                }
                this.primengTableHelper.totalRecordsCount = result.count;
                this.primengTableHelper.records = result.productions;
                this.productionPlan = result
                this.primengTableHelper.hideLoadingIndicator();
                this.processLineList = result.processLineList


                this.diagram.initialContentAlignment = go.Spot.Center;
                this.diagram.grid.visible = true; // 画布上面是否出现网格
                this.diagram.grid.gridCellSize = new go.Size(10, 10);
                this.diagram.nodeTemplateMap.add(
                    "Process",
                    this.goGo(
                        go.Node,
                        "Auto",
                        {
                            locationSpot: new go.Spot(0.5, 0.5),
                            locationObjectName: "SHAPE",
                            resizable: true,
                            resizeObjectName: "SHAPE",
                        },
                        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(
                            go.Point.stringify
                        ),
                        this.goGo(
                            go.Shape,
                            "RoundedRectangle",
                            {
                                name: "SHAPE",
                                strokeWidth: 2,
                                fill: this.goGo(go.Brush, "Linear", {
                                    start: go.Spot.Left,
                                    end: go.Spot.Right,
                                    0: "gray",
                                    0.5: "white",
                                    1: "gray",
                                }),
                            },
                            {
                                click: function (e, obj) {
                                },
                            },
                            new go.Binding("fill"),

                            new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(
                                go.Size.stringify
                            )
                        ),

                        this.goGo(
                            go.TextBlock,
                            {
                                alignment: go.Spot.Center,
                                textAlign: "center",
                                margin: 5,
                                editable: true,
                            },
                            new go.Binding("text").makeTwoWay()
                        )
                    )
                );
                this.diagram.linkTemplateMap.add(
                    "noGj",
                    this.goGo(
                        go.Link,
                        this.goGo(go.Shape, {
                            strokeWidth: 2,
                        })
                    )
                );
                this.processNodeList = [];
                this.nodeDataArray = [];
                this.linkDataArray = [];
                this.processNodeList = result.processNodeList
                // color: "red" 字体和边框颜色
                // details: null详情
                // figure: null 形状
                // fill: "red" 底色
                // key: "512ab6a4-4ed4-4102-dcbd-08d9637ca58e"
                // loc: null 坐标
                // nodeDrawingNo: "tuhao2" 节点图号
                // parentId: "00000000-0000-0000-0000-000000000000"
                // size: 0 大小
                // sort: 0
                // text: "name2" 节点名称
                // workingHour: 0

                result.processNodeList.forEach(item => {
                    let itemI = {
                        key: item.key,
                        category: "Process",
                        loc: item.loc,
                        text: item.text,
                        fill: item.fill,
                        color:item.color
                    }
                    this.nodeDataArray.push(itemI)
                })


                result.processLineList.forEach(line => {
                    let itemLine = {
                        from: line.from,
                        to: line.to
                    }
                    this.linkDataArray.push(itemLine)
                })
                this.diagram.model = new go.GraphLinksModel(
                    this.nodeDataArray,
                    this.linkDataArray
                );
            });
    }
    // 加载工序工步节点 
    getProductionTechquine(nodeId, node) {
        this._productionDesignServiceProxy.getProductionTechquine(
            nodeId
        )
            .pipe(finalize(() => { }))
            .subscribe(result => {
                let childNodes = this.isEqual(JSON.parse(JSON.stringify(result)))
                node.children = childNodes
                node.treeList = childNodes
            });
    }
    /** 默认排配计划
     * nodeId!: string | undefined; 当前点击节点id
     * bopDescId!: string | undefined; 任务id 
     * startTime!: moment.Moment | undefined; 开始日期
     * endTime!: moment.Moment | undefined; 结束日期
     * nodeDesc!: string | undefined; 节点描述
     */
    getDefaultArrangement() {
        if (!this.selectedFiles1) {
            this._messageService.warn("请先选择一个节点")
            return
        }
        if (this.selectedFiles1.treeList.length == 0) {
            this._messageService.warn("当前节点下无数据")
            return
        }
        this.defaultInfo.endTime = moment(this.defaultEndTime).add(1, 'days')
        this.defaultInfo.startTime = moment(this.defaultInfo.startTime).add(1, 'days')
        this.defaultInfo.bopDescId = this.files2[0].id
        this.defaultInfo.nodeId = this.selectedFiles1.id
        this.defaultInfo.nodeDesc = this.selectedFiles1.nodeName
        if (this.saveFlag) {
            this.saveFlag = false;
            this._productionDesignServiceProxy.defaultArrangement(
                this.defaultInfo
            )
                .pipe(finalize(() => { }))
                .subscribe(result => {
                    this.saveFlag = true;
                    if (result.code == 0) {
                        this.defaultVisible = false
                        this._messageService.success("成功")
                        this.getNodePlanDetails()
                    } else {
                        this._messageService.error(result.message)
                    }

                });
        }
    }

    // 手动排配计划
    handManage() {
        if (this.selectRow.length === 0) {
            this._messageService.warn("请选择要排序的列表")
            return
        }
        let input = new HandManageInput();
        Object.assign(input, this.handelInfo)
        input.guidList = []
        this.selectRow.forEach(element => {
            input.guidList.push(element.id)
        });
        let organizationUnitId: any = input.organizationUnitId
        let userId: any = input.userId
        let idStr = "", idnameStr = "", unitIdStr = "", unitnameStr = "";
        if (userId != undefined) {
            userId.forEach(element => {
                idStr += `${element.id},`
                idnameStr += `${element.userName},`
            });
        }
        idStr = idStr.substring(0, idStr.length - 1)
        idnameStr = idnameStr.substring(0, idnameStr.length - 1)
        if (organizationUnitId != undefined) {
            organizationUnitId.forEach(element => {
                unitIdStr += `${element.id},`
                unitnameStr += `${element.displayName},`
            });
        }
        unitIdStr = unitIdStr.substring(0, unitIdStr.length - 1)
        unitnameStr = unitnameStr.substring(0, unitnameStr.length - 1)
        input.userId = idStr
        input.userName = idnameStr
        input.organizationUnitDesc = unitnameStr
        input.organizationUnitId = unitIdStr
        input.startTime = moment(this.startTimeH).add(1,'days')
        input.endTime = moment(this.endTimeH).add(1,'days')
        if (this.saveFlag) {
            this.saveFlag = false;
            this._messageService.confirm(
                '确定排配数据？',
                (isConfirmed) => {
                    if (isConfirmed) {
                        this._productionDesignServiceProxy.handManage(
                            input
                        )
                            .pipe(finalize(() => { }))
                            .subscribe(result => {
                                this.saveFlag = true;
                                if (result.code == 0) {
                                    this._messageService.success("成功")
                                    this.defaultVisible = false
                                    this.getNodePlanDetails()
                                } else {
                                    this._messageService.error(result.message)
                                }
                            });
                    }
                }
            );
        }
    }
    // 下发任务
    taskIssue() {
        if (this.selectRow.length === 0) {
            this._messageService.warn("请选择要排序的列表")
            return
        }
        let guidList = []
        this.selectRow.forEach(element => {
            guidList.push(element.id)
        });
        if (this.saveFlag) {
            this.saveFlag = false;
            this._messageService.confirm(
                '确定下发任务？',
                (isConfirmed) => {
                    if (isConfirmed) {
                        this._productionDesignServiceProxy.issueTask(
                            guidList
                        )
                            .pipe(finalize(() => { }))
                            .subscribe(result => {
                                this.saveFlag = true;
                                if (result.code == 0) {
                                    this._messageService.success("成功")
                                    this.getNodePlanDetails()
                                } else {
                                    this._messageService.error(result.message)
                                }
                            });
                    }
                }
            );
        }
    }
    //履历
    llVisibleEv(id) {
        this.llVisible = true
        this._operationHistoryServiceProxy.getOperationLogList(
            id
        )
            .pipe(finalize(() => { }))
            .subscribe(result => {
                this.logList = result
            });
    }
    updateEv(item) {
        this.addInfoUi.endTime = item.endTime ? item.endTime._d : undefined
        this.addInfoUi.startTime = item.startTime ? item.startTime._d : undefined
        this._productionDesignServiceProxy.getSchedulerById(
            item.id
        )
            .pipe(finalize(() => { }))
            .subscribe(result => {
                if (this.selectedFiles1.isRelation != 1 && this.selectedFiles1.nodeLevel != 8) {
                    this._productionDesignServiceProxy.getShowBanZuFlag(
                        [item.nodeId],
                        this.files2[0].id
                    )
                        .pipe(finalize(() => { }))
                        .subscribe(result => {
                            this.banZuFlag = result;
                        });
                }
                this.addVisible = true;
                this.addInfoUi.workingHour = result.workingHour
                this.addInfoUi.guidList = []
                this.addInfoUi.guidList.push(result.id);
                this.addInfoUi.performanceHour = result.performanceHour
                this.dialogType = '任务计划修改'
                this.addInfoUi.remark = result.remark
                this.addInfoUi.renovateFlag = "0";
                let organizationUnitIdArr = item.organizationUnitId == null ? [] : item.organizationUnitId.split(',')
                organizationUnitIdArr = organizationUnitIdArr.filter(num => num != '')
                this.addInfoUi.organizationUnitId = []
                organizationUnitIdArr.forEach(element => {
                    this.addInfoUi.organizationUnitId.push(this.getOrganizationUnitList.filter((ele, index) => {
                        return ele.id == element
                    })[0])
                });

                let userIdArr = item.userId == null ? [] : item.userId.split(',')
                userIdArr = userIdArr.filter(num => num != '')
                this.addInfoUi.userId = []
                userIdArr.forEach(element => {
                    this.addInfoUi.userId.push(this.getOrganizationUnitUsersByIdList.filter((ele, index) => {
                        return ele.id == element
                    })[0])
                });
            });
    }
    // 修改
    upatePlanEv() {
        let flag: any = this.addInfoUi.renovateFlag
        flag == "1" ? this.addInfoUi.renovateFlag = true : this.addInfoUi.renovateFlag = false
        let organizationUnitId: any = this.addInfoUi.organizationUnitId
        let userId: any = this.addInfoUi.userId
        let idStr = "", idnameStr = "", unitIdStr = "", unitnameStr = "";
        userId.forEach(element => {
            idStr += `${element.id},`
            idnameStr += `${element.userName},`
        });
        idStr = idStr.substring(0, idStr.length - 1)
        idnameStr = idnameStr.substring(0, idnameStr.length - 1)
        organizationUnitId.forEach(element => {
            unitIdStr += `${element.id},`
            unitnameStr += `${element.displayName},`
        });
        unitIdStr = unitIdStr.substring(0, unitIdStr.length - 1)
        unitnameStr = unitnameStr.substring(0, unitnameStr.length - 1)
        this.addInfoUi.userId = idStr
        this.addInfoUi.userName = idnameStr
        this.addInfoUi.organizationUnitDesc = unitnameStr
        this.addInfoUi.organizationUnitId = unitIdStr
        if (this.saveFlag) {
            this.saveFlag = false;
            this._productionDesignServiceProxy.upatePlan(
                this.addInfoUi
            )
                .pipe(finalize(() => { }))
                .subscribe(result => {
                    this.saveFlag = true;
                    if (result.code == 0) {
                        this.addVisible = false
                        this._messageService.success("修改成功")
                        this.getNodePlanDetails()
                    } else {
                        this._messageService.error(result.message)
                    }
                });
        }

    }
    defaultEv() {
        // if (this.selectRow.length === 0) {
        //     this._messageService.warn("请选择要排配的任务")
        //     return
        // }
        this._productionDesignServiceProxy.getDateTimeDefault(
            this.selectedFiles1.id
        )
            .pipe(finalize(() => { }))
            .subscribe(result => {
                if (result != '') {
                    this.defaultEndTime = new Date(result);
                }
            });
        this.defaultVisible = true;
        this.dialogType = '默认排配计划'
    }
    // 手动排配
    handelEv() {
        if (this.selectRow.length === 0) {
            this._messageService.warn("请选择要排配的任务")
            return
        }
        this.banZuFlag = false;
        this.impFlag = false;
        if (this.selectedFiles1.isRelation == 1 || this.selectedFiles1.nodeLevel == 8) {
            this.dialogType = '手动排配计划';
            this.defaultVisible = true
        } else {
            let guid = [];
            for (const item of this.selectRow) {
                guid.push(item.nodeId);
            }
            this._productionDesignServiceProxy.getShowBanZuFlag(
                guid,
                this.files2[0].id
            )
                .pipe(finalize(() => { }))
                .subscribe(result => {
                    this.banZuFlag = result;
                    if (result) {
                        this.dialogType = '手动排配计划';
                        this.defaultVisible = true
                        if (this.selectRow.length == 1 && (this.selectRow[0].startTime != undefined && this.selectRow[0].endTime != undefined)) {
                            this.startTimeH = new Date(this.selectRow[0].startTime);
                            this.endTimeH = new Date(this.selectRow[0].endTime);
                        }
                        if (this.selectedFiles1.nodeLevel == 8) {
                            this.impFlag = true;
                        } 
                    } else {
                        this._messageService.info('芯级/部套任务计划不能手动排配')
                    }
                });
        }

    }
    //弹窗隐藏
    displayclose(): void {
        this.material = [];
        this.startTimeH = undefined;
        this.endTimeH = undefined;
        this.addInfoUi = new HandManageInput();//新增集合
        this.defaultInfo = new DefaultArrangementInput()
        this.handelInfo = new HandManageInput();
    }

}
